import { request } from "@utils/http";

//引入请求类型
import {
  getHosListSearchParamsType,
  getProvinceListItemType,
  hospitalListReturnType,
  hospitalDetailType,
  hospitalDepartmentListType,
  hospitalScheduleRuleParamsType,
  hospitalScheduleRuleReturnType,
  findScheduleListParamsType,
  findSCheduleListReturnType
} from "./model/hospitalListTypes";

//获取医院列表数据的请求
export const getHospitalListRequest = (
  page: number,
  limit: number,
  search?: getHosListSearchParamsType
) => {
  return request.get<any, hospitalListReturnType>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params: search,
    }
  );
};

//获取省份的请求
export const getProvinceListRequest = () => {
  return request.get<any, getProvinceListItemType>(
    "/admin/cmn/dict/findByDictCode/province"
  );
};

//获取市级的请求
export const getCityListRequest = (value: string) => {
  return request.get<any, getProvinceListItemType>(
    `/admin/cmn/dict/findByParentId/${value}`
  );
};

//查看的时候请求医院详情信息
export const getHospitalDetailRequest = (id: string) => {
  return request.get<any, hospitalDetailType>(`/admin/hosp/hospital/show/${id}`);
};

//状态改变的请求
export const statusChangeRequest=(id:string,status:0|1)=>{
  return request.get<any, null>(`/admin/hosp/hospital/updateStatus/${id}/${status}`);
}

//医院所有科室的请求
export const getHospitalDepartmentListRequest=(hoscode:string)=>{
  return request.get<any,hospitalDepartmentListType>(`/admin/hosp/department/${hoscode}`)
}

//某个科室的详细排班时间的请求
export const getHosScheduleRuleRequest=({page,limit,hoscode,depcode}:hospitalScheduleRuleParamsType)=>{
  return request.get<any,hospitalScheduleRuleReturnType>(`/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`)
}

//获取科室某个科室某个事件的具体详情
export const findScheduleListRequest=({hoscode,depcode,workDate}:findScheduleListParamsType)=>{
  return request.get<any,findSCheduleListReturnType>(`/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`)
}